﻿<%@ Page Title="Quản lý chương học" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="frmTaoChuongHoc.aspx.cs" Inherits="Admin_frmTaoChuongHoc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="wrap">
        <h2>
            Quản lý chương học |
                <asp:HyperLink ID="HyperLink2" runat="server" CssClass="node"
                NavigateUrl="~/Admin/QuanLyMonHoc.aspx" BackColor="#F1F1F2" >Quản lý môn học</asp:HyperLink>
        </h2>
    </div>
    <div style="clear: both;">&nbsp;</div>
  
    <div class="wrap" style="border: solid 1px #CCCCCC;">
        <table style="width: 100%">
            <tr>
                <td style="height: 32px; width: 117px;">
                    Tên chương&nbsp;&nbsp;&nbsp;&nbsp; : 
                                        
                </td>
                <td style="height: 32px; width: 421px;">
                    <asp:TextBox ID="txtChuonghoc" runat="server" Height="30px" 
                        TextMode="MultiLine" Width="270px"></asp:TextBox>
                    
                </td>
                <td style="height: 32px; width: 471px;">
                    </td>
            </tr>
            <tr>
                <td style="width: 117px">
                    Tên môn học&nbsp;&nbsp;&nbsp;&nbsp;:
                    </td>
                <td style="width: 421px">
                    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                        <ContentTemplate>
                            <asp:DropDownList ID="drlTenMonHoc" runat="server" Height="25px" Width="270px" 
                                AutoPostBack="True" DataSourceID="LinqDataSource1" DataTextField="TenMonHoc" DataValueField="MsMonHoc">
                                <asp:ListItem Value="MaMon02">WIN</asp:ListItem>
                                <asp:ListItem Value="MaMon01">CSDL</asp:ListItem>
                            </asp:DropDownList>
                            <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="DataClassesDataContext" 
                                                Select="new (MsMonHoc, TenMonHoc)"  TableName="tbl_MONHOCs">
                            </asp:LinqDataSource>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
                <td style="width: 471px">
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" 
                            AutoGenerateColumns="False" CssClass="GridViewStyle" GridLines="None" 
                            DataSourceID="LinqDataSource2" Width="259px" 
                                onrowcommand="GridView1_RowCommand">
                                <Columns>
                                    <asp:TemplateField HeaderText="" >
                                        <ItemTemplate>
                                            <input name="MyRadioButton" type="radio"  style="width:35px;"
                                                        value='<%# Eval("MaChuong") %>' />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:CommandField ShowSelectButton="True" />

                                    <asp:BoundField DataField="MaChuong" HeaderText="Mã Chương" ReadOnly="True" SortExpression="MaChuong" />
                                    <asp:BoundField DataField="TenChuong" HeaderText="Tên Chương" ReadOnly="True" SortExpression="TenChuong" />
                                    <asp:TemplateField ShowHeader="False">
                                        <ItemTemplate>
                                            <asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="true" 
                                                CommandName="MyDelete" ImageUrl="~/Images/cross.png" CommandArgument='<%#Eval("MaChuong") %>'
                                                Text="Delete" style="padding-left:10px; padding-right:10px;"/>
                                            <ajaxToolkit:ModalPopupExtender BackgroundCssClass="modalBackground" ID="lnkDelete_ModalPopupExtender"
                                                runat="server" TargetControlID="ImageButton2" PopupControlID="DivDeleteConfirmation"
                                                OkControlID="ButtonDeleleOkay" CancelControlID="ButtonDeleteCancel">
                                            </ajaxToolkit:ModalPopupExtender>
                                            
                                            <ajaxToolkit:ConfirmButtonExtender ID="lnkDelete_ConfirmButtonExtender" runat="server" Enabled="True"
                                                TargetControlID="ImageButton2" DisplayModalPopupID="lnkDelete_ModalPopupExtender">
                                            </ajaxToolkit:ConfirmButtonExtender> 
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                </Columns>
                                <RowStyle CssClass="RowStyle" />
                                <EmptyDataRowStyle CssClass="EmptyRowStyle" />
                                <PagerStyle CssClass="PagerStyle" />
                                <SelectedRowStyle CssClass="SelectedRowStyle" />
                                <HeaderStyle CssClass="HeaderStyle" />
                                <EditRowStyle CssClass="EditRowStyle" />
                                <AlternatingRowStyle CssClass="AltRowStyle" />
                            </asp:GridView>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                    <asp:LinqDataSource ID="LinqDataSource2" runat="server" 
                        ContextTypeName="DataClassesDataContext" Select="new (MaChuong, TenChuong)" 
                        TableName="tbl_CHUONGHOCs" Where="MsMonHoc == @MsMonHoc">
                        <WhereParameters>
                            <asp:ControlParameter ControlID="drlTenMonHoc" Name="MsMonHoc" 
                                PropertyName="SelectedValue" Type="String" />
                        </WhereParameters>
                    </asp:LinqDataSource>
                </td>
            </tr>
            <tr>
                <td style="width: 117px">
                
                    <br />
                
                    <asp:Button class="button" ID="btnThemChuong" runat="server" Text="Thêm Chương" 
                        Height="27px" Width="109px" onclick="btnThemChuong_Click" />

                    
                    <br />
                    
                    &nbsp;</td>
                <td style="width: 421px">
                
                    &nbsp;</td>
                <td style="width: 471px">
                    &nbsp;</td>
            </tr>
        </table>
    </div>

    <script type="text/javascript">
        function KtraChuong() {
            if ($.trim($("#<%=txtChuonghoc.ClientID%>").val()) == 0) {
                alert("Thông báo! Tên chương không được để trống!");
                return false;
            }
        }
    </script>
</asp:Content>


